package sc.prototype.pfs.eventnotify.collector;

import java.util.ArrayList;
import java.util.List;

import sc.prototype.pfs.eventnotify.excep.CollectContentException;
import sc.prototype.pfs.eventnotify.model.Notice;
import sc.prototype.pfs.eventnotify.model.NoticeContent;
import sc.prototype.pfs.eventnotify.model.NotifyConfig;
import sc.prototype.pfs.eventnotify.model.NotifyContext;

public interface NoticeFactory {

    CreateStuff create(NotifyConfig config, NotifyContext context) throws CollectContentException;

    /**
     * 创建结果，预留了一种配置产生通知和通知内容多对多的可能性，
     * 也为了方便外部对通知内容和通知分别落地。
     */
    public static class CreateStuff {
        List<Notice> notices;
        List<NoticeContent> noticeContents;

        public boolean hasNotice() {
            return notices != null && notices.size() != 0;
        }

        public List<Notice> getNotices() {
            if (notices == null) {
                notices = new ArrayList<Notice>();
            }
            return notices;
        }

        public void setNotices(List<Notice> notices) {
            this.notices = notices;
        }

        public List<NoticeContent> getNoticeContents() {
            if (noticeContents == null) {
                noticeContents = new ArrayList<NoticeContent>();
            }
            return noticeContents;
        }

        public void setNoticeContents(List<NoticeContent> noticeContents) {
            this.noticeContents = noticeContents;
        }

    }
}
